package com.tanhua.controller;

import com.tanhua.model.vo.SoundVo;
import com.tanhua.server.impl.PeachblossomService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

@RestController
@RequestMapping("/peachblossom")
public class PeachblossomController {
    @Autowired
    private PeachblossomService peachblossomService;

    //发送语音
    @PostMapping
    public ResponseEntity postpeachblossom(MultipartFile soundFile) throws IOException {
        peachblossomService.savePeachblossom(soundFile);

        return ResponseEntity.ok(null);
    }

    //接收语音
    @GetMapping
    public ResponseEntity getpeachblossom() {
     SoundVo vo = peachblossomService.getPeachblossom();
        return ResponseEntity.ok(vo);
    }
}
